<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <legend>SEO设置</legend>
            <div>
                <form class="layui-form layui-form-pane" lay-filter="seoset">

                    <div class="layui-form-item">
                        <label class="layui-form-label">SEO标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="seotitle" autocomplete="off" placeholder="请输入SEO标题"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">SEO关键字</label>
                        <div class="layui-input-block">
                            <input type="text" name="keywords" autocomplete="off" placeholder="请输入SEO关键字,多个逗号隔开"
                                class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">SEO描述</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入SEO描述" name="description" class="layui-textarea"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">自动SEO</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="seo" lay-skin="switch" lay-text="开启|关闭">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <button type="button" class="layui-btn" lay-submit="" lay-filter="seoset">保存</button>
                    </div>
                </form>
            </div>
        </fieldset>
    </div>


</div>

<script>
    layui.use(['form', 'lycms'], function () {
        var form = layui.form
            , layer = layui.layer, lycms = layui.lycms;
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();


        //监听提交
        form.on('submit(seoset)', function (data) {
            lycms.seoOperate(data);
            return false;
        });

        // 页面初始化
        $(document).ready(function () {
            //获取初始信息
            $.post("/v1/admin/data/seoset", function (data, status) {
                //表单初始赋值
                form.val('seoset', data);
            });
        });
    });
</script>